package com.neusoft.springboot04.controller;


import com.neusoft.springboot04.common.MyException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class IndexController {

    @RequestMapping("/index.do")
    public ModelAndView indexJsp()
    {
        System.out.println("进入controller！！！");
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("index");
        return modelAndView;
    }

    @RequestMapping("/index01.do")
    public ModelAndView indexJsp001() throws Exception {
        System.out.println("进入controller！！！");
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("index0001");
        return modelAndView;
    }

    @RequestMapping("/index02.do")
    public ModelAndView indexJsp002() throws Exception {
        System.out.println("进入controller！！！");
        throw new MyException("自定义异常，服务器出现问题","自定义异常，服务器出现问题");

        ///return modelAndView;
    }

    @RequestMapping("/index03.do")
    public ModelAndView indexJsp003() throws Exception {
        System.out.println("进入controller！！！");
        throw new Exception("有错误！！！！");

        ///return modelAndView;
    }
}
